package com.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.dao.ModuleMapper;
import com.model.Module;
import com.service.IModuleService;

@Service("moduleService")
public class ModuleServiceImpl implements IModuleService {
	@Resource
	private ModuleMapper moduleMapper;

	public Module getModuleById(Integer id) {
		return moduleMapper.selectByPrimaryKey(id);
	}

	public int saveModule(Module u) {
		int i = moduleMapper.insertSelective(u);
		return i;
	}

	public List<Module> findAll(Map<Object, Object> map) {
		List<Module> list = moduleMapper.selectAllModules(map);
		return list;
	}

	public int updateModule(Module u) {
		int i = moduleMapper.updateByPrimaryKeySelective(u);
		return i;
	}

	public int countModules() {
		return moduleMapper.countModules();
	}
	
	
	public List<Module> selectParentModules(Map<Object, Object> map) {
		List<Module> list = moduleMapper.selectParentModules(map);
		return list;
	}

	
	

}
